package com.zxy.leetcode.lcci;

/**
 * https://leetcode-cn.com/problems/is-unique-lcci/
 */
public class Test0101 {

    public static void main(String[] args) {
        Test0101 test = new Test0101();
        System.out.println(test.isUnique("abcad"));
        System.out.println(test.isUnique("abc"));
    }

    public boolean isUnique(String astr) {
        char[] chars = astr.toCharArray();
        java.util.HashSet set = new java.util.HashSet();
        for (char c : chars) {
            if (set.contains(c)) {
                return false;
            }
            set.add(c);
        }
        return true;
    }

}
